package com.zzptc.sky.translate;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by Administrator on 2017/11/1.
 */

public class MyAdapter extends PagerAdapter {
List<View> lists;
    public MyAdapter(List list) {
        this.lists=list;
    }
    @Override
    public int getCount() {
        return lists.size();
    }
    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }
    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(lists.get(position));
        return lists.get(position);
    }
    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(lists.get(position));
    }
}
